# @FileName  : test2.py
# @Time      : 2025/2/17 16:23
# @Author    : LuZhaoHui
# @Software  : PyCharm

from modelscope.models import Model
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from PIL import Image
from tool import *

# 指定本地模型路径
model_id = AIMODELDIR + '/Qwen/Qwen2.5-VL-3B-Instruct'
# 替换为你的本地模型路径

# 创建pipeline
img_cls = pipeline(task=Tasks.image_classification, model=Model.from_pretrained(model_id))

# 读取图片
img_path = '/home/luzhaohui/image/ocrTest/id0.jpg'  # 替换为你的图片路径
image = Image.open(img_path)

# 进行推理
result = img_cls(image)
print("推理结果:", result)